﻿using LinFu.AOP.Interfaces;
using LinFu.IoC.Configuration;
using LinFu.IoC.Interfaces;

namespace CoreEx.Wcf.Common.Implementation
{
    [PostProcessor]
    public class ServiceContractInterceptorPostProcessor : IPostProcessor
    {
        public void PostProcess(IServiceRequestResult result)
        {
            if (result.ServiceType == typeof(IInterceptor) && result.ServiceName == "ServiceContractInterceptor")
            {
                if (result.OriginalResult == null)
                {
                    result.ActualResult = new DefaultServiceContractInterceptor(result.AdditionalArguments[1]);
                }
            }
        }
    }
}
